﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EIIS.FrameWork.DomainModel;

namespace EIIS.Infrastructure.Model.System.Authority
{
    /// <summary>
    /// 菜单节点
    /// </summary>
    public class MenuNode:TreeNode
    {
        /// <summary>
        /// 请求地址
        /// </summary>
        public virtual string ActionName { get; set; }

        /// <summary>
        /// 请求地址
        /// </summary>
        public virtual string ControllerName { get; set; }

        /// <summary>
        /// 图标
        /// </summary>
        public virtual string IconCls { get; set; }

        /// <summary>
        /// 访问地址
        /// <remarks>使用GetURL()函数根据ControllerName和ActionName生成</remarks>
        /// </summary>
        public virtual string Url { get; set; }

        /// <summary>
        /// 是否页面
        /// </summary>
        public virtual bool IsPage { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        public virtual string Description { get; set; }

        /// <summary>
        /// 角色列表
        /// </summary>
        public virtual Iesi.Collections.Generic.ISet<Role> Roles { get; set; }

        /// <summary>
        /// 根据ControllerName和ActionName生成URL
        /// </summary>
        /// <returns></returns>
        public static string GetURL(string controllerName, string actionName)
        {
            string url = "";
            if (!string.IsNullOrEmpty(controllerName) && !string.IsNullOrEmpty(actionName))
            {
                url = string.Format("/{0}/{1}", controllerName, actionName);
            }
            return url;
        }

       

    }
}
